---
layout: single
elementName: a
---

<section id="a" class="element">
  <header class="element-header">
    <nav class="element-links">
        <span>
          Type: <strong>inline</strong>
        </span>
      <span>
        Self-closing:
        <strong>
            No
        </strong>
      </span>
      <a class="element-links-direct" href="{{site.url}}/element/a/" data-element-name="a" data-tooltip="Single page for this element">Permalink</a>
      <a class="element-share" data-tooltip="Share on Twitter or Facebook" data-element-name="a">Share</a>
      <a target="_blank" href="https://developer.mozilla.org/en/docs/Web/HTML/Element/a" data-tooltip="See on Mozilla Developer Network" rel="external">MDN</a>
    </nav>
    <h2 class="element-name">
      <a href="#a">
        <span>#</span>
        a
      </a>
    </h2>
    <div class="element-description">
      <p>Creates a <strong>link</strong> to a URL: a web page, a section within a page, an email address... Also called the <code>anchor</code> element, where the <code>a</code> comes from.</p>

    </div>
  </header>

      <div id="a-example-0" class="example">
        <p class="example-label">
          <strong>Example:</strong>
          <a class="example-clipboard" data-tooltip="Click to copy code" data-clipboard-target="#a-example-0-code">Copy</a>
        </p>
        <article class="example-preview">
            <div class="example-output"><a href="https://htmlreference.io">HTML Reference</a></div>
          <div id="a-example-0-code" class="example-code">{% highlight html %}<a href="https://htmlreference.io">HTML Reference</a>{% endhighlight %}</div>
        </article>
      </div>

    <article id="a-href" class="attribute attribute--required">
      <header class="attribute-header">
        <h3 class="attribute-name">
          <code class="tag" data-tooltip="Click to copy" data-clipboard-text="href">
            href
          </code>
        </h3>
        <div class="attribute-description">
          <p>Defines the target of the link.</p>

            <strong class="attribute-is-required">Required.</strong>
        </div>
      </header>

      <div class="attribute-values">
          <article id="a-href-httphtmlreferenceio" class="value">
            <header class="value-header">
                <h4 class="value-name">
                  <code class="tag" data-tooltip="Click to copy href=&quot;https://htmlreference.io&quot;" data-clipboard-text="href=&quot;https://htmlreference.io&quot;">
                      "https://htmlreference.io"
                  </code>
                </h4>
              <div class="value-description">
                <p>You can pass an <strong>absolute</strong> URL.</p>

              </div>
            </header>
            <aside class="value-preview">
              <div class="value-output"><a  href="https://htmlreference.io">HTML Reference</a></div>
            </aside>
          </article>
          <article id="a-href-elementdiv" class="value">
            <header class="value-header">
                <h4 class="value-name">
                  <code class="tag" data-tooltip="Click to copy href=&quot;/element/div&quot;" data-clipboard-text="href=&quot;/element/div&quot;">
                      "/element/div"
                  </code>
                </h4>
              <div class="value-description">
                <p>You can pass a URL <strong>relative</strong> to the root domain.</p>

              </div>
            </header>
            <aside class="value-preview">
              <div class="value-output"><a  href="/element/div">HTML Reference</a></div>
            </aside>
          </article>
          <article id="a-href-footer" class="value">
            <header class="value-header">
                <h4 class="value-name">
                  <code class="tag" data-tooltip="Click to copy href=&quot;#footer&quot;" data-clipboard-text="href=&quot;#footer&quot;">
                      "#footer"
                  </code>
                </h4>
              <div class="value-description">
                <p>You can target an element within the <em>same</em> page. Here, we target the element <code>&lt;div id=&quot;footer&quot;&gt;</code></p>

              </div>
            </header>
            <aside class="value-preview">
              <div class="value-output"><a  href="#footer">Footer</a></div>
            </aside>
          </article>
          <article id="a-href-mailtoalexsmithcom" class="value">
            <header class="value-header">
                <h4 class="value-name">
                  <code class="tag" data-tooltip="Click to copy href=&quot;mailto:alex@smith.com&quot;" data-clipboard-text="href=&quot;mailto:alex@smith.com&quot;">
                      "mailto:alex@smith.com"
                  </code>
                </h4>
              <div class="value-description">
                <p>You can use the <code>mailto</code> protocol. Clicking the link will open the user&#39;s email client.</p>

              </div>
            </header>
            <aside class="value-preview">
              <div class="value-output"><a  href="mailto:alex@smith.com">Contact me</a></div>
            </aside>
          </article>
      </div>
    </article>
    <article id="a-target" class="attribute">
      <header class="attribute-header">
        <h3 class="attribute-name">
          <code class="tag" data-tooltip="Click to copy" data-clipboard-text="target">
            target
          </code>
        </h3>
        <div class="attribute-description">
          <p>Defines in which tab or window the clicked link will show up.</p>

        </div>
      </header>

      <div class="attribute-values">
          <article id="a-target-_blank" class="value">
            <header class="value-header">
                <h4 class="value-name">
                  <code class="tag" data-tooltip="Click to copy target=&quot;_blank&quot;" data-clipboard-text="target=&quot;_blank&quot;">
                      "_blank"
                  </code>
                </h4>
              <div class="value-description">
                <p>Opens in a new browsing context, which is usually a <strong>new tab</strong>.</p>

              </div>
            </header>
            <aside class="value-preview">
              <div class="value-output"><a  href="https://htmlreference.io" target="_blank">HTML Reference</a></div>
            </aside>
          </article>
          <article id="a-target-_self" class="value">
            <header class="value-header">
                <h4 class="value-name">
                  <code class="tag" data-tooltip="Click to copy target=&quot;_self&quot;" data-clipboard-text="target=&quot;_self&quot;">
                      "_self"
                  </code>
                </h4>
              <div class="value-description">
                <p>Opens in the current tab.</p>

              </div>
            </header>
            <aside class="value-preview">
              <div class="value-output"><a  href="https://htmlreference.io" target="_self">HTML Reference</a></div>
            </aside>
          </article>
          <article id="a-target-_parent" class="value">
            <header class="value-header">
                <h4 class="value-name">
                  <code class="tag" data-tooltip="Click to copy target=&quot;_parent&quot;" data-clipboard-text="target=&quot;_parent&quot;">
                      "_parent"
                  </code>
                </h4>
              <div class="value-description">
                <p>Opens in the parent browsing context, or <code>_self</code> is there is none.</p>

              </div>
            </header>
            <aside class="value-preview">
              <div class="value-output"><a  href="https://htmlreference.io" target="_parent">HTML Reference</a></div>
            </aside>
          </article>
          <article id="a-target-_top" class="value">
            <header class="value-header">
                <h4 class="value-name">
                  <code class="tag" data-tooltip="Click to copy target=&quot;_top&quot;" data-clipboard-text="target=&quot;_top&quot;">
                      "_top"
                  </code>
                </h4>
              <div class="value-description">
                <p>Opens in the top browsing context, or <code>_self</code> is there is none.</p>

              </div>
            </header>
            <aside class="value-preview">
              <div class="value-output"><a  href="https://htmlreference.io" target="_top">HTML Reference</a></div>
            </aside>
          </article>
      </div>
    </article>
    <article id="a-rel" class="attribute">
      <header class="attribute-header">
        <h3 class="attribute-name">
          <code class="tag" data-tooltip="Click to copy" data-clipboard-text="rel">
            rel
          </code>
        </h3>
        <div class="attribute-description">
          <p>Defines how the link target relates to the current web page.</p>

        </div>
      </header>

      <div class="attribute-values">
          <article id="a-rel-nofollow" class="value">
            <header class="value-header">
                <h4 class="value-name">
                  <code class="tag" data-tooltip="Click to copy rel=&quot;nofollow&quot;" data-clipboard-text="rel=&quot;nofollow&quot;">
                      "nofollow"
                  </code>
                </h4>
              <div class="value-description">
                <p>The target is not related. Used for external websites usually.</p>

              </div>
            </header>
            <aside class="value-preview">
              <div class="value-output"><a  rel="nofollow">HTML Reference</a></div>
            </aside>
          </article>
      </div>
    </article>
</section>
